All Questions
Tagged with monadsfunctional-programming
17 questions
5votes
1answer
925views
Monad object in C++
Have I defined a Monad object for C++? Below is a class called var which I created years ago to implement a lambda calculus like interpreter in C++. The class ...
7votes
1answer
422views
A beginner's brainfuck interpreter in Haskell
I am rather new to haskell, and could use some feedback on my code and the decisions I had to make. In my previous project, I made a JSON parser, but relied heavily on guidance from a university ...
5votes
1answer
173views
Typescript monad for data being loaded
I have been struggling to make typescript happy about the types. I am pulling data from our backend API and I wanted to give context to the data. Basically it is a monad with 4 shapes: Initial (...
1vote
1answer
50views
Stack Exchange API Reader
I've been working on some code to pull questions from the realtime feed on stackexchange.com and query more information about them from the API. It works, but I'd love some feedback on how I could ...
2votes
0answers
62views
Monadic implementation of asynchronous tasks (hidden overhead of threads)
So, I've been reading about monads and I wanted to see if I could implement a system for asynchronous computation in a monadic way. I came up with two solutions: The first one spawns a thread for ...
7votes
1answer
133views
Monadic list for a more functional approach to C#
I am learning about monadic structures and have created a sort of monad list that implements the map and binding "operators" (or technically methods) in C#. I understand that Linq already exists and ...
8votes
1answer
618views
F# Either computation expression with while loop
I want to implement an Either computation expression in F#. The computation executes a function inside a while loop, and this function's return type is ...
4votes
1answer
1kviews
Monad Implementation in Typescript
Having been introduced to monads through Scala, I am trying to add the generalized design pattern to my toolkit by implementing it in a language I use more regularly (typescript). My tests pass (...
6votes
1answer
396views
Algebraic Effect Monad to separate pure and impure code
I want to write my C# code in a way which makes effects (state, I/O, etc) explicit in the type signature. I have started to understand monads, and have some acquaintance with algebraic effects, though ...
8votes
1answer
384views
Functional Programming Library
I have started putting together a functional programming library in C# which is somewhat inspired by scalaz and the book Functional Programming in Scala. I am hoping to get some feedback on the Monad ...
5votes
2answers
320views
Checking in four directions for board game win
I have the following code which I would like to simplify in Haskell, although I'm not sure how. I recall that I can use monads to simplify a case chain when the result of the case leads onto a next ...
5votes
1answer
360views
Popping from a list in state while a condition is true
I'm dealing with data that stores its state as a String, treating the string like a stack. I also have to combine that with error handling. To that end, I'm using ...
2votes
2answers
626views
Haskell monads: sum of primes
They say you cannot get out of the monad, but I need to use the result (at least for assertions / unit tests). But print how does it do it? Otherwise, I worked ...
8votes
1answer
228views
Monadic Immutable Linked List in the Least Functional Language Evar
I've written a List monad as an example for a related question. This is a rather frustrating experience as I wanted to use Java, which (as of Java 7) still lacks lambda expressions and lacks higher-...
10votes
2answers
1kviews
Monad transformers in C# for use in validation
I am working on using monad transformers in C#. I would like to know if the following code I present, shows that I have understood this. I am fairly new to this so any feedback / comments are really ...